package com.ysd.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.ysd.entity.NewsClassify;
import com.ysd.uitl.DBManager;

public class NewsClassifyDaoImpl {
			public List<NewsClassify> getNewsClassifyList(){
				List<NewsClassify> list=new ArrayList<NewsClassify>();
				Connection	conn=DBManager.getConnection();
				Statement st=null;
				ResultSet rs=null;
				try {
					st=conn.createStatement();
					rs=st.executeQuery("select n.newsClassifyId,n.newsClassifyName from newsclassify n");
					while(rs.next()) {
						int newsClassifyId=rs.getInt("newsClassifyId");
						String newsClaassifyName=rs.getString("newsClassifyName");
						NewsClassify n=new NewsClassify(newsClassifyId,newsClaassifyName);
						list.add(n);
					}
					return list;
				} catch (SQLException e) {
					// TODO: handle exception
					return null;
				} finally {
					DBManager.closeAll(conn, st, rs);
				}
			}
}
